<link href="../Public/css/skin.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../Public/js/jquery-1.4.3.min.js"></script>
<script charset="utf-8" src="../Public/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="../Public/js/swfupload.js"></script>
<script type="text/javascript" src="../Public/js/handlers.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>文章修改</title>

<style type="text/css">
	<!--
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
		background-color: #EEF2FB;
	}
	
	-->
	textarea {
		display: block;
	}
</style>



<script language="javascript">
KE.show({
	id : 'body',
	imageUploadJson : '__APP__/Kindeditor/upload_json',
	fileManagerJson : '__APP__/Kindeditor/file_manager_json',
	allowFileManager : true
});
</script>


<script type="text/javascript">
		var swfu;
		var num = {$accessorydata|count=###};
		var imagesPath = "../Public/images/";
		window.onload = function () {
			swfu = new SWFUpload({
				// Backend Settings
				upload_url: "__APP__/Accessory/imgUpload",
				post_params: {"PHPSESSID": "<?php echo session_id(); ?>"},

				// File Upload Settings
				file_size_limit : "<?php echo ini_get('upload_max_filesize');?>B",
				file_types : "*.jpg;*.png;*.gif;*.jpeg",
				file_types_description : "JPG Images; PNG Image;GIF Images;JPEG Images",
				file_upload_limit : 0,

				// Event Handler Settings - these functions as defined in Handlers.js
				//  The handlers are not part of SWFUpload but are part of my website and control how
				//  my website reacts to the SWFUpload events.
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Button Settings
				button_image_url : "../Public/images/SmallSpyGlassWithTransperancy_17x18.png",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 180,
				button_height: 18,
				button_text : '<span class="button">上传图片 </span>',
				button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				
				// Flash Settings
				flash_url : "../Public/swf/swfupload.swf",
				flash9_url : "../Public/swf/swfupload_fp9.swf",

				custom_settings : {
					upload_target : "divFileProgressContainer",
					thumbnail_height: 400,
					thumbnail_width: 400,
					thumbnail_quality: 100
				},
				
				// Debug Settings
				debug: false
			});
		};

		function delself(id){
			$.get("__APP__/Accessory/delImg/id/"+id,function(msg){
				if(msg.state = "success"){
					var divid = $("#div_"+id);
					var thumbnails = $("#thumbnails");
					divid.remove();
					num--;
					if(num <= 0)thumbnails.css("display","none");
				}else{
					alert('网络错误');
				}
			});
		}

		$(document).ready(function(){
			if(num>0){
				$("#thumbnails").css("display","block");
			}
		});
	</script>

<body>

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" valign="top"
				background="../Public/images/mail_leftbg.gif"><img
				src="../Public/images/left-top-right.gif" width="17" height="29" />
			</td>
			<td valign="top" background="../Public/images/content-bg.gif">
				<table
					width="100%" height="31" border="0" cellpadding="0" cellspacing="0"
					class="left_topbg" id="table2">
					<tr>
						<td height="31"><div class="titlebt">编辑文章</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="16" valign="top"
				background="../Public/images/mail_rightbg.gif"><img
				src="../Public/images/nav-right-bg.gif" width="16" height="29" />
			</td>
		</tr>
		
		<tr>
			<td valign="middle" background="../Public/images/mail_leftbg.gif">&nbsp;</td>
			<td valign="top" bgcolor="#F7F8F9">
				<table width="98%" border="0" align="center" cellpadding="0"
					cellspacing="0">
					<tr>
						<td valign="top" class="td_top"></td>
					</tr>
					<tr>
						<td>
						
							<form method="post" id="list" action="__URL__/update">
								<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#CCCCCC" class="content">
								     <!-- 主键 -->
									<input type="hidden" name="id" id="id" value="{$data.id}" 	readonly="true">
									
									<tr>
										<td class="edit_left">标题：</td>
										<td class="edit_right">
											 <input type="text" name="title" id="title" value="{$data.title}" class="edit_input" style="width: 550px;">
										</td>
									</tr>
									<tr>
										<td class="edit_left">所属分类：</td>
										<td class="edit_right">
											<div class="edit_select">
												<select name="cid">
													<option value="0">无</option>
													<iterate name="article_categoriesdata" id="v"> 
														 <eq name="data['cid']" value="$v['id']">
															<option value="{$v.id}" selected="selected">{$v.name}</option>
														   <else />
															<option value="{$v.id}">{$v.name}</option>
														 </eq> 
													</iterate>
												</select>
											</div></td>
									</tr>
									<tr>
										<td class="edit_left">排序：</td>
										<td class="edit_right">
										 <input type="text" name="order" id="order" value="{$data.order}" class="edit_input">
										</td>
									</tr>
									<tr>
										<td class="edit_left">SEO关键词：</td>
										<td class="edit_right">
										  <input type="text" name="keywords" id="keywords" value="{$data.keywords}" class="edit_input" style="width: 550px;"></td>
									</tr>
									<tr>
										<td class="edit_left">SEO描述：</td>
										<td class="edit_right">
										 <input type="text" name="description" id="description" value="{$data.description}" class="edit_input" style="width: 550px;">
										</td>
									</tr>
									<tr>
										<td class="edit_left">内容：</td>
										<td class="edit_right">
										  <textarea id="body" name="body"	cols="100" rows="8"	style="width: 550px; height: 200px; visibility: hidden;">{$data.body|h=###}</textarea>
										</td>
									</tr>
									<tr>
										<td class="edit_left">状态：</td>
										<td class="edit_right">
										 <if condition="$data.state eq 1">  <!-- 启用1 禁用0 -->
											<input type="radio" name="state" value="1" checked="checked">启用
											<input type="radio" name="state" value="0">禁用
										 <elseif condition="$data.state eq 0" /> 
										     <input type="radio" name="state" value="1">启用 
											 <input type="radio" name="state" value="0" checked="checked">禁用
										 <else />
											<input type="radio" name="state" value="1">启用
											<input type="radio" name="state" value="0">禁用 </if>
										</td>
									</tr>
									
									<tr>
										<td class="edit_left">上传图片：</td>
										<td class="edit_right">
											
											<div id="thumbnails" class="edit_input" style="width: 538px; padding: 0px; margin-bottom: 10px; height: auto; display: none;">
												<iterate name="accessorydata" id="val">
													<div id="div_{$val.id}" style="width: 115px; float: left; text-align: center;">
														<img src="__PUBLIC__/accessory/img/{$val.thumbnail}"
															width='72' height='72'
															style="margin: 5px; vertical-align: middle; opacity: 1;">
														<br>
														<a href="javascript:delself({$val.id});">删除</a> 
														<input type="hidden" value="{$val.id}" name="imgs[]">
													</div>
												</iterate>
												<div style="clear: both;"></div>
											</div>
											
											<div>
												<span id="spanButtonPlaceholder"></span>
											</div>
											
											<div id="divFileProgressContainer"></div></td>
									</tr>
									
									<tr>
										<td colspan="2">
										   <a href="javascript:list.submit();"	id="submit" class="operation_submit"	style="margin-left: 430px; margin-top: 30px;"></a>
										</td>
									</tr>
								</table>
							</form>
							
						</td>
					</tr>
					<tr>
						<td height="40"></td>
					</tr>
					<tr>
						<td width="51%" class="left_txt"><img
							src="../Public/images/icon-mail2.gif" width="16" height="11">
							客户服务邮箱：{$Think.config.sysconfig.services_email}<br> <img
							src="../Public/images/icon-phone.gif" width="17" height="14">
							官方网站：{$Think.config.sysconfig.website}</td>
					</tr>
				</table>
			</td>
			<td background="../Public/images/mail_rightbg.gif">&nbsp;</td>
		</tr>
		<tr>
			<td valign="bottom" background="../Public/images/mail_leftbg.gif"><img
				src="../Public/images/buttom_left2.gif" width="17" height="17" />
			</td>
			<td background="../Public/images/buttom_bgs.gif"><img
				src="../Public/images/buttom_bgs.gif" width="17" height="17">
			</td>
			<td valign="bottom" background="../Public/images/mail_rightbg.gif"><img
				src="../Public/images/buttom_right2.gif" width="16" height="17" />
			</td>
		</tr>
	</table>

</body>
